home *** CD-ROM | disk | FTP | other *** search
- ; SETE.ASM
- ; This is code for the IBM PC et al that provides a menu driven
- ; set-up routine for the Epson FX80 printer. Alternately, a
- ; command tail can be used, using the same codes as given in the menu.
- ; This program is placed in the public domain and is written by
- ; Joseph C. Hudson, 4198 Warbler Dr. Flint, MI 48504
- ; Adapted from GEMSET.ASM by
- ; R.R.Jones 226 Valley Rd. Lawrenceville, Ga. 30245 MNet 70270,117
-
- cr equ 0Dh
- lf equ 0Ah
- conout equ 9
- getcon equ 7
-
- setp segment byte
-
- assume cs:setp
- org 100h ;Setup as COM file
- begin: jmp start ;Skip over data area
- comnd db ? ;variable to hold command
- istail db ? ;dummy variable for tail
- numrem db ? ;var for no of chars still in tail
- banner db cr,lf,lf,lf,lf,lf,' '
- db ' (A) Pica (10) (J) Cancel Italics'
- db cr,lf,lf,' '
- db ' (B) Elite (12) (K) Skip Over Perf 2 Lines'
- db cr,lf,lf,' '
- db ' (C) Condensed (17) (L) Set Left Margin at 10'
- db cr,lf,lf,' '
- db ' (D) Unidirectional Printing (M) Expanded Print'
- db cr,lf,lf,' '
- db ' (E) Emphasized (N) Cancel Expanded'
- db cr,lf,lf,' '
- db ' (F) Cancel Emphasized '
- db cr,lf,lf,' '
- db ' (G) Double Strike (P) Print Test Line'
- db cr,lf,lf,' '
- db ' (H) Cancel Double Strike (Q) Quit'
- db cr,lf,lf,' '
- db ' (I) Italics (R) Reset Printer'
- db cr,lf,lf,' '
- db '$'
-
- ;*****************************************************************************
- ; Here begin the definitions of the printer control strings. This is a *
- ; table where each entry begins with the unique search key formed in al *
- ; by the routine "highbit", is followed in memory by the actual printer *
- ; control codes, and ends with a zero. When the key is found the lineprinter *
- ; will be sent everthing after the key, up to the -1 which is the "stopper" *
- ;*****************************************************************************
-
- ptable db 225,27,'P',18,-1 ;A - Each code group must end in -1
- db 226,27,'M',-1 ;B
- db 227,15,-1 ;C
- db 228,27,'U',1,-1 ;D
- db 229,27,'E',-1 ;E
- db 230,27,'F',-1 ;F
- db 231,27,'G',-1 ;G
- db 232,27,'H',-1 ;H
- db 233,27,'4',-1 ;I
- db 234,27,'5',-1 ;J
- db 235,27,'N',2,-1 ;K
- db 236,27,'l',10,-1 ;L
- db 237,27,'W',1,-1 ;M
- db 238,27,'W',0,-1 ;N
- db 240,'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLNO',-1 ;P
- db 242,,27,'@',-1 ;R
- endtable equ $
- lentbl equ endtable - ptable ;Get length of printer string table
-
- start: mov istail,0 ;set tail dummy to 0
- mov si,offset 80h ;go to command tail
- mov al,[si] ;get length of command tail
- mov numrem,al ;put length of tail in numrem
- again: cmp numrem,0 ;is there any tail left?
- jne proceed ;yes, proceed
- cmp istail,0 ;no, was there a tail?
- je start1 ;no, go get commands
- jmp quit ;yes, all done, so quit.
- proceed: inc si ;point at next character in tail
- dec numrem ;decrement counter
- mov al,[si] ;get next character from tail
- or al,20h ;make it lower case
- cmp al,6fh ;is it o? }remove these 2 lines
- je again ;yes, not command }if you add o as a
- cmp al,60h ;is it below a? command.
- jle again ;yes, so not a letter
- cmp al,73h ;no. is it above r?
- jge again ;yes, so not a command
- mov istail,1 ;no, is a command. Set dummy to 1
- jmp chkq ;process the command
-
- start1: mov dx,offset banner ;point to banner
- mov ah,conout ;write to console function
- int 21h ;call DOS
-
- keyget: mov ah,getcon ;get character from keyboard
- int 21h
- or al,20h ;change to lower case
- mov dl,al
- mov ah,02h ;write character to screen
- int 21h
-
- ; There is 1 special case - Q returns to DOS
-
- chkq: mov bl,'q' ;special handling for q
- cmp al,bl ;Does he want to quit now?
- jne highbit ;No, not a q, check other possibilities
-
- quit: call crlf ;Send cr and lf to printer
- mov ah,4ch ; and quit.
- int 21h
-
- highbit: mov comnd,al ;save command
- or al,10000000b ;setup search key
- mov di,offset ptable ;setup to see table
- mov cx,lentbl ;get length of table into counter
- next: mov ah,[di] ;take table entry
- cmp al,ah ;is this equal to search key?
- je gotpntr ;yes, now send string to printer
- dec cx ;no, continue search , dec counter
- jcxz keyget ;if counter is 0 not a legal search key
- inc di ;one deeper into table, please
- jmp next ;and look at another table byte
- gotpntr: inc di ;Bump past key
- mov dl,[di] ;take byte in to be sent to printer
- mov dh,-1 ;set up to see if end of print string
- cmp dl,dh ;set zero flag if so
- je lpfin ;yes, all done, finish up printer
- mov ah,5 ;pr inter code
- int 21h
- jmp gotpntr ;get next printer string byte
- lpfin: mov al,comnd ;get command back
- cmp al,'p' ;did we print test line?
- jne nextone ;no, continue
- call crlf ;yes, send cr and lf to printer
- nextone: cmp istail,0 ;do we have a tail?
- je keyget ;no, go wait for command
- jmp again ;yes, continue processing tail
-
- crlf proc near ;send cr and lf to printer
- mov ah,5 ;printer function number
- mov dl,cr ;put cr in dl
- int 21h ;call DOS
- mov ah,5
- mov dl,lf ;put lf in dl
- int 21h ;call DOS
- ret
- crlf endp
-
- setp ends
- end begin